#encoding:utf-8

import urllib.request
import urllib.parse  #将字典解析成参数字符串

#urlencode 详解

url = "http://www.baidu.com/s?"
params = {
    "wd":'刘德华',
}

qs = urllib.parse.urlencode(params)

url = url + qs

res = urllib.request.urlopen(url)
print(res.read().decode('utf-8'))